/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.trainee.aplikasipenjualan.entity;

/**
 *
 * @author Jaka
*/

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;






/**
 *
 * @author Jaka
 */

@Entity
@Table(name="m_barang")
public class Barang{
    
    @Id
    @Column(name="kodeBrg", length=10)
    private String kodeBrg;
    
    @Column(name="namaBrg", length=30, nullable=false)
    private String namaBrg;
    
    @OneToMany(mappedBy="barang")
    @Cascade(value=CascadeType.ALL)
    private List<PenjualanDetail> detail = new ArrayList<PenjualanDetail>();
    
    //SETTER GETTER
    public List<PenjualanDetail> getDetail() {
        return detail;
    }

    public void setDetail(List<PenjualanDetail> detail) {
        this.detail = detail;
    }

    
    public String getKodeBrg() {
        return kodeBrg;
    }

    public void setKodeBrg(String kodeBrg) {
        this.kodeBrg = kodeBrg;
    }

    public String getNamaBrg() {
        return namaBrg;
    }

    public void setNamaBrg(String namaBrg) {
        this.namaBrg = namaBrg;
    }
    
}

